<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>盒子居中</title>
    <link rel="stylesheet" href="css/reset.css">
    <style>
        .top_bar {
            width: 100%;
            height: 40px;
            background-color: #333;
        }
        .container {
            width: 1200px;
            /*父级的100%*/
            height: 100%;
            /*上下0 左右自动*/
            margin: 0 auto;
            /*margin-left: auto;*/
            /*margin-right: auto;*/
            background-color: red;
        }
    </style>
</head>
<body>
<div class="top_bar">
    <div class="container">
        小米商城
    </div>
</div>
</body>
</html>
